package com.bi.autotest.pages;

import com.auto.base.PageAppium;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

/**
 * Created by yidian on 2018/4/13.
 */
public class H5LoginPage extends PageAppium {

    public final String GG_CHANGE_STORE_XP="//android.view.View[@content-desc='故宫']";
    public final String QWER_CHANGE_STORE_XP="//android.view.View[@content-desc='qwer']";
    public final String CHANGE_USER_BUTTON_XP="//android.view.View[@content-desc='切换账户 ']";
    public final String APPLY_OPENTEXT_XP="//android.view.View[@content-desc='申请开通']";
    public final String CHANGE_OPERATOR_BUTTON_XP="//android.view.View[@content-desc='切换另一个操作员']";
    public final String PHONE_ERRORTEXT_XP="//android.view.View[@content-desc='手机号输入有误。']";
    public final String NO_PHONETEXT_XP="//android.view.View[@content-desc='请输入手机号']";
    public final String ERROR_VCODE_XP="//android.view.View[@content-desc='验证码无效']";
    public final String NO_VCODE_XP="//android.view.View[@content-desc='请输入验证码']";
    public final String CONFIRM_XP="//android.view.View[@content-desc='确定']";
    public final String NOTOPEN_STORE_XP="//android.view.View[@content-desc='您还没有开店哦～']";
    public final String LOGIN_TEXT_NOREGIST_XP="//android.view.View[@content-desc='[登录]']";


    public H5LoginPage(AndroidDriver androidDriver) {
        super(androidDriver);
    }

    public AndroidElement getGG_ChangeButton(){
        return waitAutoByXp(GG_CHANGE_STORE_XP);
    }

    public AndroidElement getQWER_ChangeButton(){
        return waitAutoByXp(QWER_CHANGE_STORE_XP);
    }

    public AndroidElement getUser_ChangeButton(){
        return waitAutoByXp(CHANGE_USER_BUTTON_XP);
    }

    public AndroidElement getOperator_ChangeButton(){
        return waitAutoByXp(CHANGE_OPERATOR_BUTTON_XP);
    }

    public AndroidElement getNoOpenLoginButton(){
        return waitAutoByXp(LOGIN_TEXT_NOREGIST_XP);
    }

    public AndroidElement getConfirmButton(){
        return waitAutoByXp(CONFIRM_XP);
    }

    public boolean isHasApplyOpen(){
        return isXpathExist(APPLY_OPENTEXT_XP);
    }

    public boolean isHasPhoneErrorText(){
        return isXpathExist(PHONE_ERRORTEXT_XP);
    }

    public boolean isHasNoPhoneText(){
        return isXpathExist(NO_PHONETEXT_XP);
    }

    public boolean isHasChangeButton(){
        return isNameElementExist(CHANGE_USER_BUTTON_XP);
    }

    public boolean isHasErrorVCode() {
        return isXpathExist(ERROR_VCODE_XP);
    }

    public boolean isHasNoVCode() {
        return isXpathExist(NO_VCODE_XP);
    }

    public boolean isHasNoOpenStore() {
        return isXpathExist(NOTOPEN_STORE_XP);
    }

}
